#ifndef _DevicesSPI_H_
#define _DevicesSPI_H_



#define SET_SPI0_NSS_HIGH() gpio_bit_set(GPIOA, GPIO_PIN_4)
#define SET_SPI0_NSS_LOW()  gpio_bit_reset(GPIOA, GPIO_PIN_4)

#define SET_SPI1_NSS_HIGH() gpio_bit_set(GPIOB, GPIO_PIN_12)
#define SET_SPI1_NSS_LOW()  gpio_bit_reset(GPIOB, GPIO_PIN_12)



void vSPI0Init(void);
void vSPI1Init(void);

#define ucSPI0WriteReadByte(ucByte) ucSPIWriteReadByte(SPI0, (ucByte))
#define cSPI0WriteDatas(pBuffer, iLength) cSPIWriteDatas(SPI0, (pBuffer), (iLength))
#define cSPI0ReadDatas(pBuffer, iLength) cSPIReadDatas(SPI0, (pBuffer), (iLength))

#define ucSPI1WriteReadByte(ucByte) ucSPIWriteReadByte(SPI1, (ucByte))
#define cSPI1WriteDatas(pBuffer, iLength) cSPIWriteDatas(SPI1, (pBuffer), (iLength))
#define cSPI1ReadDatas(pBuffer, iLength) cSPIReadDatas(SPI1, (pBuffer), (iLength))

#define ucSPI2WriteReadByte(ucByte) ucSPIWriteReadByte(SPI2, (ucByte))
#define cSPI2WriteDatas(pBuffer, iLength) cSPIWriteDatas(SPI2, (pBuffer), (iLength))
#define cSPI2ReadDatas(pBuffer, iLength) cSPIReadDatas(SPI2, (pBuffer), (iLength))

uint8_t ucSPIWriteReadByte(uint32_t uiSpiPeriph, uint8_t ucByte);
int8_t cSPIWriteDatas(uint32_t uiSpiPeriph, void *pvBuff, int32_t iLength);
int8_t cSPIReadDatas(uint32_t uiSpiPeriph, void *pvBuff, int32_t iLength);


#endif
